package com.twu.biblioteca;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: Shreyansh
 * Date: 22/8/13
 * Time: 11:10 PM
 * To change this template use File | Settings | File Templates.
 */
public class UserChoiceManager {
    int choiceEntered;
    BookManager bookManager = new BookManager();
    MovieList movieList= new MovieList();
    BookList bookList=new BookList();
    LoginManager loginManager = new LoginManager();
    MemberDetails memberDetails = new MemberDetails();
    Scanner userInput = new Scanner(System.in);
    public void getUserOption(){
        System.out.println("Enter The Required Option");
        choiceEntered = userInput.nextInt();

    }

    public void respond(int userChoice) {
        if(userChoice==1)
        {
            if(LoginManager.isLogged ==false)
            {
                loginManager.userLogin();
            }
            else
            {
                loginManager.userLogout();
            }
        }
        else if(userChoice==2)
        {
            bookList.viewListOfBooks();
        }
        else if(userChoice==3)
        {
            bookList.viewAvailableBooks();
        }
        else if(userChoice==4)
        {
            if(LoginManager.isLogged ==false)
            {
                System.out.println("Please login to avail this service");
            }
            else
            {
                Scanner bookName = new Scanner(System.in);
                System.out.println("Enter The name of the Book");
                String bookToBeReserved = bookName.nextLine();
                bookManager.reserveBook(bookToBeReserved);
            }
        }
        else if(userChoice==5)
        {


            memberDetails.getMemberDetails();

        }
        else if(userChoice==6)
        {
            movieList.viewMovieList();
        }
        else if(userChoice!=7)
        {
            System.out.println("Please Enter Valid Option!!!");
        }
    }
}
